import { RouteRecordRaw } from 'vue-router';

/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink:true 2、链接地址不为空`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，，开启条件，`1、isIframe:true 2、链接地址不为空`
 *      auth：          当前路由权限标识（多个请用逗号隔开），最后转成数组格式，用于与当前用户权限进行对比，控制路由显示、隐藏
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */
const baseMeta = {
	isLink: '',
	isHide: false,
	isKeepAlive: true,
	isAffix: false,
	isIframe: false,
	auth: ['admin', 'test'],
	icon: 'iconfont icon-caidan',
};

/**
 * 定义静态路由
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const staticRoutes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'index',
		component: () => import('/@/layout/index.vue'),
		redirect: '/visualizingDemo2',
		meta: {
			title: '首页',
			isKeepAlive: true,
		},
		children: [
			{
				path: '/home',
				name: 'home',
				component: () => import('/@/views/home/index.vue'),
				meta: {
					title: 'message.router.home',
					isLink: '',
					isHide: true,
					isKeepAlive: true,
					isAffix: true,
					isIframe: false,
					auth: ['admin', 'test'],
					icon: 'iconfont icon-shouye',
				},
			},
			{
				path: '/system',
				name: 'system',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/system/setting',
				meta: {
					title: 'message.router.system',
					...baseMeta,
					icon: 'iconfont icon-xitongshezhi',
				},
				children: [
					{
						path: '/system/setting',
						name: 'systemSetting',
						component: () => import('/@/views/table/yujingShezhi.vue'),
						meta: {
							title: '预警设置',
							...baseMeta,
							icon: 'el-icon-odometer',
						},
					},
					{
						path: '/system/record',
						name: 'systemRecord',
						component: () => import('/@/views/eventLog/eventLog.vue'),
						meta: {
							title: '预警记录',
							...baseMeta,
						},
					},
				],
			},
			{
				path: '/konwledge',
				name: 'konwledge',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/konwledge/hazardous-chemicals',
				meta: {
					title: '文档库',
					...baseMeta,
				},
				children: [
					{
						path: '/konwledge/hazardous-chemicals',
						name: 'hazardous-chemicals',
						component: () => import('/@/views/wiki/kownlage.vue'),
						meta: {
							//title: 'message.router.menu13',
							title: '危化知识库',
							...baseMeta,
						},
					},
					{
						path: '/konwledge/disaster-plan',
						name: 'disaster-plan',
						component: () => import('/@/views/wiki/DisasterPlan.vue'),
						meta: {
							title: '自然灾害应急预案参考',
							...baseMeta,
						},
					},
				],
			},
			{
				path: '/menu/menu1',
				name: 'menu1',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/menu/menu1/menu11',
				meta: {
					title: 'message.router.menu1',
					...baseMeta,
				},
				children: [
					{
						path: '/menu/menu1/menu11',
						name: 'menu11',
						component: () => import('/@/views/table/jijieDian.vue'),
						meta: {
							title: 'message.router.menu11',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu13',
						name: 'menu13',
						component: () => import('/@/views/table/shusanLuxian.vue'),
						meta: {
							title: 'message.router.menu13',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu14',
						name: 'menu14',
						component: () => import('/@/views/table/shusanDiyu.vue'),
						meta: {
							title: '疏散地域管理',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu15',
						name: 'menu15',
						component: () => import('/@/views/table/yinbiDi.vue'),
						meta: {
							title: '隐蔽地域管理',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu16',
						name: 'menu16',
						component: () => import('/@/views/table/baozhangDian.vue'),
						meta: {
							title: '防空警报点管理',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu18',
						name: 'menu18',
						component: () => import('/@/views/table/supportDian.vue'),
						meta: {
							title: '保障点管理',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu17',
						name: 'menu17',
						component: () => import('/@/views/table/ssysTongji.vue'),
						meta: {
							title: '疏散要素统计',
							...baseMeta,
						},
					},
				],
			},
			{
				path: '/menu/menu1/menu12/menu128',
				name: 'menu128',
				component: () => import('/@/views/fun/echartsMap/allmap.vue'),
				meta: {
					title: '全部地图',
					...baseMeta,
					icon: 'icon-diqiu iconfont',
				},
			},
			{
				path: '/menu',
				name: 'menu',
				component: () => import('/@/layout/routerView/parent.vue'),
				redirect: '/menu/menu1',
				meta: {
					title: '数据管理',
					...baseMeta,
				},
				children: [
					{
						path: '/menu/menu2/menu21',
						name: 'menu21',
						component: () => import('/@/views/table/ComplexTable.vue'),
						meta: {
							title: '重要经济目标',
							...baseMeta,
						},
					},

					{
						path: '/menu/menu3',
						name: 'menu3',
						component: () => import('/@/views/table/zhanbeiWuzi.vue'),
						meta: {
							title: '战备物资',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu4',
						name: 'menu4',
						component: () => import('/@/views/table/zhuanyeDuiwu.vue'),
						meta: {
							title: '专业队伍',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu5',
						name: 'menu5',
						component: () => import('/@/views/table/zhihuiJigou.vue'),
						meta: {
							title: '人防工程',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu2/menu23',
						name: 'menu23',
						component: () => import('/@/views/yuanFangAn/List.vue'),
						meta: {
							title: '防护救援方案',
							...baseMeta,
						},
					},
					{
						path: '/menu/menu1/menu12/menu127',
						name: 'menu127',
						component: () => import('/@/views/fun/echartsMap/allmap.vue'),
						meta: {
							title: '全部地图',
							isLink: '',
							isHide: true,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							auth: ['admin', 'test'],
							icon: 'icon-diqiu iconfont',
						},
					},
				],
			},
			{
				path: '/gridLayout',
				name: 'funGridLayout',
				component: () => import('/@/views/fun/gridLayout/index.vue'),
				meta: {
					title: '子系统入口',
					...baseMeta,
					icon: 'iconfont icon-tuodong',
				},
			},
			{
				path: '/lianjieyuancheng',
				name: 'lianjieyuancheng',
				component: () => import('/@/views/table/tiaozhuanFangwen.vue'),
				meta: {
					title: '子系统管理',
					...baseMeta,
					icon: 'iconfont icon-neiqianshujuchucun',
				},
			},
			{
				path: '/visualizing',
				name: 'visualizingIndex',
				component: () => import('/@/layout/routerView/parent.vue'),
				meta: {
					...baseMeta,
					icon: 'el-icon-data-line',
					isLink: `http://${window.location.host}/index.html#/visualizingDemo2`,
					isHide: true,
					isKeepAlive: false,
				},
			},
			{
				path: '/fun/countup',
				name: 'funCountup',
				component: () => import('/@/views/dangAn/dangAn.vue'),
				meta: {
					title: 'message.router.funCountup',
					...baseMeta,
					icon: 'el-icon-odometer',
				},
			},
			{
				path: '/wangpan',
				name: 'funEchartsTree',
				//component: () => import('/@/views/system/user/index.vue'),
				component: () => import('/@/views/file/File.vue'),
				meta: {
					title: '档案云盘',
					...baseMeta,
					icon: 'el-icon-connection',
				},
			},
			{
				path: '/link',
				name: 'layoutLinkView',
				component: () => import('/@/layout/routerView/link.vue'),
				meta: {
					title: 'message.router.layoutLinkView',
					isLink: 'http://127.0.0.1',
					isHide: true,
					isKeepAlive: false,
					isAffix: false,
					isIframe: false,
					auth: ['admin'],
					icon: 'iconfont icon-caozuo-wailian',
				},
			},
		],
	},
	{
		path: '/404',
		name: 'notFound',
		component: () => import('/@/views/error/404.vue'),
		meta: {
			title: 'message.staticRoutes.notFound',
			isHide: true,
		},
	},
	{
		path: '/401',
		name: 'noPower',
		component: () => import('/@/views/error/401.vue'),
		meta: {
			title: 'message.staticRoutes.noPower',
			isHide: true,
		},
	},
	/**
	 * 提示：写在这里的为全屏界面，不建议写在这里
	 * 请写在 `dynamicRoutes` 路由数组中
	 */
	{
		path: '/visualizingDemo1',
		name: 'visualizingDemo1',
		component: () => import('/@/views/visualizing/demo1.vue'),
		meta: {
			title: 'message.router.visualizingLinkDemo1',
			isHide: true,
		},
	},
	{
		path: '/visualizingDemo2',
		name: 'visualizingDemo2',
		component: () => import('/@/views/visualizing/demo2.vue'),
		meta: {
			title: 'message.router.visualizingLinkDemo2',
			isHide: true,
		},
	},
];
